// 鼠标悬停显示/隐藏悬浮框，带延迟，防止断档
// 适用于ul和.right下所有.deepArrow

document.addEventListener('DOMContentLoaded', function() {
    // 所有带下拉的菜单
    var arrows = document.querySelectorAll('.deepArrow');
    arrows.forEach(function(arrow) {
        var j1 = arrow.querySelector('.j1');
        if (!j1) return;
        var timer = null;
        // 鼠标进入主菜单或悬浮框
        function show() {
            clearTimeout(timer);
            j1.style.display = 'block';
        }
        // 鼠标离开主菜单和悬浮框
        function hide() {
            timer = setTimeout(function() {
                j1.style.display = 'none';
            }, 150); // 150ms延迟
        }
        arrow.addEventListener('mouseenter', show);
        arrow.addEventListener('mouseleave', hide);
        j1.addEventListener('mouseenter', show);
        j1.addEventListener('mouseleave', hide);
    });
});
